package com.pwc.testing.test;

import java.util.List;
import java.util.concurrent.TimeUnit;

import org.junit.Assert;
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.NoSuchElementException;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.chrome.ChromeOptions;
import org.openqa.selenium.support.ui.FluentWait;
import org.openqa.selenium.support.ui.Wait;

import com.google.common.base.Function;

public class test {

	// @Test
	public void test() {
		// parses the string with specified radix
		long a = Long.parseLong("0", 10);
		System.out.println(a);

		long b = Long.parseLong("111", 10);
		System.out.println(b);

		long c = Long.parseLong("-0", 10);
		System.out.println(c);

		long d = Long.parseLong("-BB", 16);
		System.out.println(d);

		long e = Long.parseLong("1010110", 2);
		System.out.println(e);

		long f = Long.parseLong("2147483647", 10);
		System.out.println(f);

		long g = Long.parseLong("-2147483648", 10);
		System.out.println(g);

		long h = Long.parseLong("ADMIN", 27);
		System.out.println(h);

		double test1 = Double.parseDouble("1000px");

	}

	@Test
	public void test1() {

		ChromeOptions o = new ChromeOptions();
		o.addArguments("disable-extensions");
		o.addArguments("--start-maximized");
		String exePath = "driver\\chromedriver.exe";
		System.setProperty("webdriver.chrome.driver", exePath);
		WebDriver driver = new ChromeDriver(o);

		driver.get("http://dict.youdao.com/");
		Wait wait = new FluentWait(driver)

				.withTimeout(30, TimeUnit.SECONDS)

				.pollingEvery(5, TimeUnit.SECONDS)

				.ignoring(NoSuchElementException.class);

		WebElement foo = (WebElement) wait.until(new Function<WebDriver,WebElement>() {

			public WebElement apply(WebDriver driver) {
				
				return driver.findElement(By.id("query"));
			}

		});
		
		

	}

}
